Can't Get List of Users

Can't get list of users

Registering a user with Firebase Authentication, by default, does nothing to modify your Firebase Database. Authentication and Database are two pretty much unrelated services. It's a common practice, once you register a user, to save an entry in your Database with their uid, so you can relate the two services:

let auth: FIRAuth? = FIRAuth.auth()    // The authentication object
auth?.createUser(withEmail: email, password: password) { (user, error) in
// If registration was successful, `user` is a FIRUser with a uid
if let userId = user?.uid {
let exampleDBPath = FIRDatabase.database().child("users").child(userId)
// Write the user object, for instance a user name or other data, to this path
exampleDBPath.setValue(someJSONAboutTheUser) { (error, result) in
// Now you have a spot to modify your user in the database
}
}
}

This FIRUser created from registration is the same type of object you'll get when a user tries to sign in, so you can find the correct user in the database via the same uid.

Can't Extract Users List With Roles From ASP.NET IdentityUserRole

public class UserRole : IdentityUserRole<string>
{
public User User { get; set; }
public Role Role { get; set; }
}

The base type IdentityUserRole<> already has a UserId and a RoleId. By adding new properties for User and Role, without configuring the context to account for those, you are essentially introducing new properties into the table (UserId1 and RoleId1) which are never populated.

You should be able to fix this by reconfiguring the context. The default configuration looks like this:

builder.Entity<TUser>(b =>
{
b.HasMany<TUserRole>().WithOne().HasForeignKey(ur => ur.UserId).IsRequired();
});

builder.Entity<TRole>(b =>
{
b.HasMany<TUserRole>().WithOne().HasForeignKey(ur => ur.RoleId).IsRequired();
});

So if you overwrite those relationship configurations, you should be able to make your navigation properties work:

public class DataContext : IdentityDbContext<User, Role, string,  IdentityUserClaim<string>, UserRole, IdentityUserLogin<string>, IdentityRoleClaim<string>, IdentityUserToken<string>>
{
public DataContext(DbContextOptions<DataContext> options)
: base(options) {}

protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);

builder.Entity<User>(b =>
{
b.HasMany<UserRole>(u => u.UserRoles)
.WithOne(ur => ur.User)
.HasForeignKey(ur => ur.UserId)
.IsRequired();
});

builder.Entity<Role>(b =>
{
b.HasMany<UserRole>(r => r.UserRoles)
.WithOne(ur => ur.Role)
.HasForeignKey(ur => ur.RoleId)
.IsRequired();
});
}
}

I haven’t tested this but it should replace the default configuration, so that you shouldn’t end up with duplicate columns on the UserRole and your navigation properties should work then.

Error: type 'ListUser' is not a subtype of type 'User' in Flutter, using Bloc 8.0.1

I'm not entirely certain if this is the source of your error, but one thing that looks suspicious to me is this code:

class SwipeLoaded extends SwipeState {
final List<User> users;

const SwipeLoaded({
required this.users,
});

@override
List<Object> get props => [users];
}

The getter props here is actually returning a List<List<User>> which I suspect may not be what you intended.

This is what I think you intended for the code:

class SwipeLoaded extends SwipeState {
final List<User> users;

const SwipeLoaded({
required this.users,
});

@override
List<User> get props => [...users];
}

Get list of projects user has access to

I've found two ways to do this.

First method: list all projects, filter based on user list

projects = GET https://dev.azure.com/{orgname}/_apis/projects?api-version=6.0
results = []
foreach project in projects:
descriptor = GET https://vssps.dev.azure.com/{orgname}/_apis/graph/descriptors/{project.id}
members = GET https://vssps.dev.azure.com/{orgname}/_apis/graph/users?api-version=6.0-preview.1&scopeDescriptor={descriptor}
if userId in members:
results.push(project)

Second method: get user entitlements

This is better because this will show all projects that people have Reader (or higher) on, where the first method doesn't show projects where the user doesn't have explicit membership

users = GET https://vsaex.dev.azure.com/{orgname}/_apis/UserEntitlements?$filter=name eq '{userId}'&$orderBy=name Ascending&select=Projects
user = [x for x in users where x.userId == userId][0]
results = user.projectEntitlements

Note the select query parameter included in the second example, this is necessary for projectEntitlements to be included in the result.

Can't get list of users

Registering a user with Firebase Authentication, by default, does nothing to modify your Firebase Database. Authentication and Database are two pretty much unrelated services. It's a common practice, once you register a user, to save an entry in your Database with their uid, so you can relate the two services:

let auth: FIRAuth? = FIRAuth.auth()    // The authentication object
auth?.createUser(withEmail: email, password: password) { (user, error) in
// If registration was successful, `user` is a FIRUser with a uid
if let userId = user?.uid {
let exampleDBPath = FIRDatabase.database().child("users").child(userId)
// Write the user object, for instance a user name or other data, to this path
exampleDBPath.setValue(someJSONAboutTheUser) { (error, result) in
// Now you have a spot to modify your user in the database
}
}
}

This FIRUser created from registration is the same type of object you'll get when a user tries to sign in, so you can find the correct user in the database via the same uid.

SharePlum error : Can't get User Info List

Ok, it seems that I found the solution for my problem, it's about the Sharepoint URL that I gave.
If we take this example : https://www.mysharepoint.com/Your/SharePoint/DocumentLibrary
You have to remove the last part : /DocumentLibrary.

Why remove this part precisely ?
In fact, when you go deep enough in your Sharepoint, your url will look like something like : https://www.mysharepoint.com/Your/SharePoint/DocumentLibrary/Forms/AllItems.aspx?RootFolder=%2FYour%2FSharePoint%2DocumentLibrary%2FmyPersonnalFolder&FolderCTID=0x0120008BBC54784D92004D1E23F557873CC707&View=%7BE149526D%2DFD1B%2D4BFA%2DAA46%2D90DE0770F287%7D

You can see that the right of the path is in RootFolder=%2FYour%2FSharePoint%2DocumentLibrary%2Fmy%20personnal%20folder and not in the "normal" URL anymore (if it were, it will be like that https://www.mysharepoint.com/Your/SharePoint/DocumentLibrary/myPersonnalFolder/).

What you have to remove is the end of the "normal" URL so in this case, /DocumentLibrary.

So my correct Sharepoint URL to input in SharePlum will be https://www.mysharepoint.com/Your/SharePoint/

I'm pretty new to Sharepoint so I'm not really sure that this I the right answer to this problem for the others persons, may someone who know Sharepoint better than me can confirm ?



Related Topics



Leave a reply



Submit