Is there any method or new features available in teams to get new user details without accessing the particular bot?
There is a possibility of implementing roaster to grab the user details like user ID and object ID based on the azure active directory. We can get the information based on the number of entries per page minimum to 50 count users. The type of information we can get is like when the user log in into the system and what are the operations done by the user based on the name ID.
Python:
async def _show_members(
self, turn_context: TurnContext
):
members = await TeamsInfo.get_team_members(turn_context)
}
Credit: surbhigupta
Related
I am using the Microsoft Graph API to access some events in my company's Azure AD Outlook.
The problem I am now having is that I can not access the CalendarView (or really I can't access the user at all) when I try to specify the user with an UUID instead of an email. The strange thing is that email works just fine, but I am not allowed to store emails outside of the Azure AD, so ID would be the preferred method.
Here is the exact API call I try to make: https://learn.microsoft.com/en-us/graph/api/user-list-calendarview?view=graph-rest-1.0&tabs=csharp
But all examples only use the .Me accessor and not the .Users[{ID | userPrincipalName}]
I am quite sure that the UUID I use is correct since it comes from an API call earlier. Or does the documentation article mean something else than the user UUID by {ID | userPrincipalName}?
A room looks like this (when read as a JSON object):
{
"id": "00000000-0000-0000-0000-000000000000"
"emailAdress": "room#company"
...
}
This works:
await graphClient.Users["room#company"].CalendarView.Request(queryOptions).GetAsync();
While this does not work:
await graphClient.Users["00000000-0000-0000-0000-000000000000"].CalendarView.Request(queryOptions).GetAsync();
When using the UUID I get (IDs not shown here):
Code: ErrorInvalidUser
Message: The requested user '<UUID>' is invalid
ClientRequestId: <some ID>
I did test this with a hardcoded room id and email but also with the ID object I get from calling the roomlist in C#.
Another inconsistency I encountered is that I can read the whole list of microsoft.graph.room via a http request but not using the C# Microsoft.Graph.Auth package. Reading the data of a room I know the email from does however work.
So does this just not work and the doc doesn't say so?
Does the Microsoft.Graph.Auth package not support those kind of requests?
Or do I use a wrong ID?
Saladino
According to some test, only when I use incorrect object id of user it shows same error message as yours.
If I use another user's object id(not object id of the user do authentication), it will show ErrorAccessDenied because do not have permission.
If I use the object id which the user not exist in Azure AD(incorrect object id), it will show same error message with yours. So please check if the uuid which you mentioned is the user's object id(shown in below screenshot) in your Azure AD and please check if you input the correct format of object id in your code by Console.WriteLine(object id)
I'm trying to save the user data to the firebase realtime database directly after the user has been created. But the problem is not the saving, but the UserID. I save also save the user ID that i get from CurrentUser. and then i check in the realtime database and saw that the ID that stored was from a last user who recently created. And i check it in the editor by getting the current user Email and it showed the last user Email not the current user who are creating at the moment. Can someone help me to get the current user ID and not the last user id.
You guys can see the image from the links.
What ID should be
The last user ID showing up instead You guys can see that the ID don't event match. I did try redo the project and looking at the videos that from firebase it self. I really have no ide what to do, i am stuck for 3 days now.
public void SaveNewUserInCode(string userId, string Name, string Email) {
var currentUser = FirebaseAuth.DefaultInstance.CurrentUser;
string userNameId;
if (currentUser != null)
{
userNameId = currentUser.Email;
user = new User(userId, Name, Email);
string Json = JsonUtility.ToJson(user);
reference.Child("Users").Child(currentUser.UserId).SetRawJsonValueAsync(Json);
Data.text = userNameId;
}
}
It would be helpful to see the code that invokes SaveNewUserInCode.
I see a few potential dangers with the code you've posted:
The first is that any call (other than Auth.SignOut) is asynchronous. If you're caching userId immediately after Auth.SignInWithEmailAndPasswordAsync, you'll likely have the previous user still in Auth.CurrentUser (until the related task completes). See my related post on all the ways to wait for a task in Unity if you think this is the issue.
The second, especially if Email is sometimes null, you may be automatically calling Auth.SignInAnonymouslyAsync every time your app starts (perhaps old logic, I usually start my prototypes with anonymous users and later on add real accounts when it's time to do some user testing). This will always overwrite your current user even if you were previously signed in anonymously. You should always check Auth.CurrentUser before calling any of the Auth.SignIn methods, but definitely make sure that you don't have a stray Auth.SignInAnonymouslyAsync laying around.
If the issue is threading, I believe the following logic will fix your problem:
var auth = FirebaseAuth.DefaultInstance;
auth.SignInWithEmailAndPasswordAsync(email, password).ContinueWithOnMainThread(task => {
// omitted : any error handling. Check task's state
var user = task.Result;
SaveNewUserInCode(user.UserId, user.DisplayName /* or however you get Name */, user.Email);
});
so im trying to create a SaaS application with ASP.NET Boilerplate, and i come into some problem as follows:
As i observe the framework, i noted that the "RegisterAsync" function in UserRegistrationManager create user based on the currently active tenant. It means if i currently log in on tenant '1', then when i register new user, the new user will have tenantId '1'. On the other hand, when i currently not logged in, if i register a new user, the app will show exception 'cannot register host user'.
public async Task<User> RegisterAsync(string name, string surname, string emailAddress, string phoneNumber, string userName, string plainPassword, bool isEmailConfirmed)
{
CheckForTenant();
var tenant = await GetActiveTenantAsync();
var user = new User
{
TenantId = tenant.Id,
Name = name,
Surname = surname,
EmailAddress = emailAddress,
PhoneNumber = phoneNumber,
IsActive = true,
UserName = userName,
IsEmailConfirmed = isEmailConfirmed,
Roles = new List<UserRole>()
};
return user;
}
private void CheckForTenant()
{
if (!AbpSession.TenantId.HasValue)
{
throw new InvalidOperationException("Can not register host users!");
}
}
The application that i want to build requires the function for new user to be able to sign up along with free trial and then paid subscription. So i think that the new user should be able to create tenant by themself. So if the new user register, they will be forced to create new tenant before they can do any other thing in the app.
The problem is that the tenantId column in User table cannot be null, so i can register without tenant. Im thinking of assign all newly created user to 'Default' tenant at first, but i think that this was not the best practices.
Is there any way to overcome this problem or any references about that? Thanks in advance!
Based on my empirical SaaS Application development experience, a typical Self-Signup flow in Multi-Tenant applications would be like the one given below
User opts to self-signin
Allow the user to pick a subscription plan (most likely a trial plan)
Get the Company Name (tenant name) as part of the signup flow
Create a new tenant that has the subscription (2)
Add the signup user as the administrator for that tenant
In case of a trial plan, set up the suitable request handler to keep validating if the tenant has crossed the subscribed number of trial days, in that case, force redirect to payment page or signout
If the user has opted to Signup for a paid subscription (during signup), after provisioning the tenant go to the payment page. Once payment succeeds, capture the transactionid and allow the user to login and use the application.
The flow that you wanted to be using is straightforward
Build a custom self-signup process, obtain the company name (Tenant Name)
Also capture the emailid of the user that is performing the sign-up
Create the tenant based on info from (1)
Set the administrator for the tenant based on the info from (2)
All your API calls should be working fine.
Note
Have a separate Self-Signup Service like (TenantSelfRegistrationService) so that you can allow anonymous access to that service.
In terms of security, set captcha and set rate-limits or CSRF Tokens etc to enforce security in the signup process.
Hope this clarifies
I looked at the code and the documentation and I think you should never allow an unknown user to create new tenants. This should happen by a person who has the correct authorization to create tenants. This is a user that exists in the host tenant.
You as admin in the host tenant need to create tenant for somebody else and add them as admin for that tenant.
Registering users is then done through the normal way with the register webpage running for that tenant.
How to do that, I leave to you to figure out with the documentation of boilerplate itself! Documentation
I'm creating a discord bot which rewards users for the amount of invites they have.
The API allows you to retrieve the invitecount of an user when they do !invites for example however this can be easily botted so I'm trying to find a way to prevent botters.
Current code :
[Command("test")]
public async Task InviteCheck()
{
var test = await Context.Guild.GetInvitesAsync();
foreach (var tests in test)
{
if (Context.User.Username + "#" + Context.User.Discriminator == tests.Inviter.ToString())
{
//amount of invites
await Context.Channel.SendMessageAsync(tests.Uses.ToString());
}
}
}
So I got this idea to check when an user joins and then check their invite link, but apparently this is not included in the API.
In the documentation : https://discord.foxbot.me/docs/api/Discord.IInviteMetadata.html
it shows that I can retrieve the inviter information (I'm not certain) but I have no clue on how to use Iinvitemetadata.
Tldr; I want to make a discord bot which checks howmany valid invitations an user has, delete the invitation if the invited user leaves. User must be in group for 10 minutes before counting as an invitation.
You can check for an event when a new user joins the guild. See here
But i think Stackoverflow is not the right place for that kind of question since it is very vague and you won't get full out of the box solutions from users.
In your place i would grab the source code from their github repository and make my way through what it can do and how.
Alternativly you should ask this kind of question in the official unofficial "Discord API" Discord-Server where there is an extra channel for your library Discord.Net called "#dotnet_discord-net" - Here you go.
i use instaSharp api to create an instagram web app
after i get token access i want to see followers and following list of my profile and another people profile
i need some method to Get another user followers and following !
in the official instagram web app you cant see followers and following list (just see amount) , So does this api support it ? How i Can do it ?
this api has a poor document and samples ,
How i can use this method ? instaSharpDoc
thanks
You can see user's followers and followings list with the official Instagram API.
https://instagram.com/developer/endpoints/relationships/ - documentation
https://api.instagram.com/v1/users/{user-id}/follows?access_token=ACCESS-TOKEN - Get the list of users this user follows.
https://api.instagram.com/v1/users/{user-id}/followed-by?access_token=ACCESS-TOKEN - Get the list of users this user is followed by.
You cannot request data from another user, e.g. followers and following, without the user authorization step.
Firstly, you need to redirect the user to an authorization page. After the user inputs his credentials, he will be redirected to a page(redirect_uri value) you have sent in the authorization request, where you will request the access_token to make requests on his account.
There is another option: you can add the username you want to make requests onto your app's Sandbox (require user verification). The username will receive a notification to authorize or revoke the access to your account. After authorizing it, you will be able to make requests on his account.
If you would like to understand more detailed information, please, have a quick look at the documentation about Sandbox at https://www.instagram.com/developer/sandbox/. It will help you clarify your mind and your implementation code.
I hope it helps you.
This solved for me using InstaSharper (without accessToken but using username and password for loggin in):
var following = await api.GetUserFollowingAsync("yourUserName",PaginationParameters.Empty);
var followers = await api.GetUserFollowersAsync("yourUserName", PaginationParameters.Empty);
This is the repository: https://github.com/a-legotin/InstaSharper
Tutorial to get starting: https://www.youtube.com/watch?v=f9leg398KAw
I don't know if this is useful but for me it works:
IResult<InstaUserShortList> followers = await api.GetUserFollowersAsync(userToScrape,
PaginationParameters.MaxPagesToLoad(5));
for (int i = 0; i < followers.Value.Count; i++)
{
Console.WriteLine($"\n\t{followers.Value[i].UserName}\n\t");
}
It gives you back the username of all of the followers of a user (change UserToScrape with the one that you prefer).