User privileges

I did a mini project where the admin can list items for unknown users to view. But is possible for Alan to allow some selected users to make the listings so that unknown users can view.
Example; Let’s consider an e commerce site where we have the vendors and the buyers. It is possible to get multiple vendors (admins) where each vendor can list their items for unknown users (buyers) to view available items.

That is possible. You can read more about it in the docs on permissions and application users.

We also have a guide for setting up user authentication that may be useful to you.

Hope this helps. Please let me know if it works for you.

Thanks. I’ve already followed the docs and I was able to implement it. It’s working fine.
But I want it to work such that ;
Example:
user1,user2,user3 can list different items independently. Non of the users should be able to alter or edit a different listing apart from the one that particular user posted.
Admin1 should be the only that can alter the listings from user1,2,3.
Viewer1,2,3 can only view listings but should not be able to alter.

You can achieve that with can-update: ... and can-read: ... statements at node types, as explained in the docs on permissions. For example:

'Users': collection ['User'] {
    'User': text
    'Type': stategroup (
        'Admin' { }
        'Buyer' { }
    )
}
'Product lists': collection ['List']
    // can-create: ...
    // can-delete: ...
{
    //only the 'List owner' and an Admin can change a 'Product lists' node.
    can-update: user is ( >'List owner' ) || user .'Type'?'Admin'

    'List': text
    'List owner': text -> ^ .'Users'[]
}

If you share code in which you attempt to express what you mention, I may be able to make more detailed suggestions on how to proceed and get a better idea of where you got stuck.

users
	dynamic: .'Users'
	user-initializer: (
		'Type' = create 'Unknown' ( )
	)

	passwords: .'Passwords'
		password-value: .'Data'.'Password'
		password-status: .'Data'.'Active'
			active: 'Yes' ( )
			reset: 'No' ( )
		password-initializer: (
			'Data' = ( )
		)

	authorities: .'Authorities'
		identities: .'Identities'>'User'
		identity-initializer: ( )
root {

	can-update: user .'Type'?'Admin'

	'Users': collection ['Name'] {
		'Name': text
		'Type': stategroup (
			'Admin' { }
			'Unknown' { }
		)
	}
	'Passwords': collection ['User'] {
		'User': text -> ^ .'Users'[]
		'Data': group {
			can-update: user is ( ^ >'User' )

			'Password': text
			'Active': stategroup (
				'No' { }
				'Yes' { }
			)
		}
	}
	'Authorities': collection ['Authority'] {
		'Authority': text
		'Identities': collection ['Identity'] {
			'Identity': text
			'User': text -> ^ ^ .'Users'[]
		}
	}

This is the simple implementation for the admin and unknown user login and sign up and it works fine.
I want to change this code to what I explained earlier.

That is a copy of the code from the docs. Please try solving the problem yourself first, and get back to us with questions about where you get stuck.

Please can you shed more light on these symbols { | | } and {?}. To get more understanding. I am getting errors with the migration.alan (from_release)

Hi Brenden, for us to be able to give an answer, we need to know:

  • what you are trying to accomplish
  • what you have already tried to do
  • at what point you got stuck, how you reached that point and how you concluded that you are stuck
  • what exactly you would like to know. Please stick to one question per forum post.