How to retrieve user role(s) in oxwall? - oxwall

I can retrieve some very basic data with:
OW::getUser()->getUserObject()
But I have no idea how to retrieve roles an user belongs to. Any idea ?

Use the authorisation service class. See example below:
// list user roles of currently logged in user
$userId = OW::getUser()->getId(); // get current user Id
BOL_AuthorizationService::getInstance()->findUserRoleList($userId); // list user roles

Related

How to retrieve files of User using user id in flutter firebase?

How do I get user id of Users when authenticated ? and will the files be stored in different collection for every user since every user is different. And finally how do I show a user his data like his images and posts when Logged In ?
If your user is authenticated with Firebase using any provided auth method by Firebase, you can get the user id in that way:
String get currUid => FirebaseAuth.instance.currentUser?.uid ?? "";
If you authenticated successfully, then a definite userId will come there. In that case, you can write as
String get currUid => FirebaseAuth.instance.currentUser!.uid;

How to check if other users are logged in on Parse via Facebook or some other way?

I know that if I want to check if PFUser.currentUser is logged with Facebook, I can use:
if FBSDKAccessToken.currentAccessToken() != nil {
print("you logged with FB!!")
//do your stuff.
}
How can I know if in a blogging app, another user is logged on parse via Facebook? (or twitter? or other ways?).
So just to be clear, I don't want to know if CURRENT USER is logged in via FB!, but if ANOTHER user is, still better HOW this user logged in.
For example, in a class named "posts" under the column "author" I have pointer to that user in default "users" class. Is there a way, planned by Parse, in wich I can perform that check? In their docs this case seems to be missing, they only talk about login, linking, referring, but not checking (if not for current user).
should I insert a new column in class User as for example "userLoggedInBy" ??

meteor: facebook signin status

How do I check and get the username from the facebook login?? I successful get the account-facebook to work but I don't know how to access to the username?
Meteor is cool but not much documentation. Or I am to new for must of the server side javascript. Thanks!
There is an object (services) where facebook info is stored on Meteor users. You can get accessToken, id, username, etc.
You can use onCreateUser to modify the user document and add the username on creation.
# on server
# coffeescript
Accounts.onCreateUser (options, user) ->
if user.services.facebook
data = user.services.facebook
user.username = data.username or "generateOne"
return user
You can use user.profile to add other fields.

Get user Location/Hometown through Facebook Graph API

Is there a way to get the location/hometown (whichever available) using the facebook graph API?
The catch here is I do not want the user to go through an authentication process, meaning I want to get the location/hometown without having the access_token
Therefore, the following case would be void
https://graph.facebook.com/USERID?fields=location,hometown&access_token=USER_ACCESS_TOKEN
Please help
Regards
access token is required with the following permissions
user_hometown
user_location
use hometown_location field of a user table to get location details. We get this info. only if a user shares it's location detail public.
If you have the permissions to access this user data, you just have to parse the key-value dict to your model, eg:
self.user.location = [user objectForKey:#"location"][#"name"];
same for hometown:
self.user.hometown = [user objectForKey:#"hometown"][#"name"];
Regards.

How can i login using email address in zend?

I have the situtation like , Admin should login as User from Admin End. I have user email address which is username for my site.
I am using following code in login page.
...
$users = new Default_Model_DbTable_Users();
$auth = Zend_Auth::getInstance();
$auth = Zend_Auth::getInstance();
$authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(),'customers');
$authAdapter->setIdentityColumn('email')->setCredentialColumn('password');
$authAdapter->setIdentity($username)->setCredential(base64_encode($password));
$authAdapter->getDbSelect()->where('status = 1');
$result = $auth->authenticate($authAdapter);
.....
Now I have to use only email address to login. I can check whether ADMIN do the user login from admin end. Is it possible to login using email address ?. Kindly advice on this
If you would like to allow admin to log in as any user from the admin panel, you don't have to use Zend_Auth::authenticate() to check any credentials against the database. All you really need to do is set up the identity like you do for a normal user login.
From admin you might do something like this:
$user = getUserInfoFromDatabase(); // get the user object used for Zend_Auth identity
$auth = Zend_Auth::getInstance()->getStorage()->write($user);
// redirect admin to user frontend
The only important thing is that whatever you write() to the storage, must be the EXACT same object/data you write to storage from your user login code.
It doesn't matter how the data gets there, as long as it is what your application requires to check identity.
Since your admin has already been authenticated and has permission to access a user account, you don't need to use Zend_Auth::authenticate() to validate the user email/password, you can skip that step and simply assign the identity for the admin directly to the session.
You may need to use separate session namespaces for admin and users if you are not already.
Hope that helps, let me know if I can clarify anything. The part where you set the identity is probably short after $result = $auth->authenticate($authAdapter); in your code, probably inside if ($result == true)