Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
So, I'm trying to do a command, called "bebr", which would give an administrator permission to the role, but I couldn't do it. Can you please help me with that? Server ID is 776512018009030686, and Role ID is 872111767709417473.
Your bot needs to have the administrator permissions in order to grant them to other roles. The role the bot is modifying also needs to be lower in hierarchy. This code does the job on my test server:
from discord import Role
from discord.ext.commands import command, Context
#command()
async def bebr(ctx: Context, role: Role):
overrides = role.permissions
overrides.administrator = True
await role.edit(permissions=overrides)
await ctx.send(f"Added administrator privileges to role {role}.")
When your bot doesn't have the administrator permission or has its role lower than the one it's trying to modify, it will throw a Missing Permissions error.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to figure out what's the correct way to authenticate users with Passport for a Vue SPA. I can't figure out which grant type I should use considering that implicit grant is not recommended by IETF’s OAuth working group and the other methods require to pass the client_secret with the request, I'm a bit lost...
I was thinking password grant but I receive a refresh token and it’s not really secure to store it in the localstorage.
I also thought about the cookie injected by laravel passport in every request but I can’t find out how to login from my SPA with this approach...
Any lead on what’s the best / more secure way to do this ?
Thanks!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have an android client which doesn't implement any username and password login, it user OTP for login. So i have only firebase userID. How can i configure WebSecurityConfigurerAdapter to use this firebase userID to authenticate user and we don't have front-end website for logging in.
you need to configure spring security to use a custom autenticationProvider, and use firebase API to verify your tokens sent as a header of you request, have a look at this example HERE
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am new to spring MVC . I want to show a register button in login page only if user is not registered
I don't know whether you stored registered user data somewhere or not, though I assume that you store it to database and try to give this answer, may this will help to you.
First of all pull out all registered user data list from database while login & check whether user login credential is present in this list or not. If present then don't show registered button otherwise show it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to create a login page via webapi with this situations .
i dont want to use token and.. but the views should be secure (not direct called in URL).
If the user is Admin load view_x.
If the user is Employee load view_y.
If the user is Student load view_z.
please give me suggestion
I believe you have a front end website which leverages this web API as you are talking about loading of views. Firstly you might want to define roles in your back-end of your web API for various types of users. For e.g. every user will belong to exactly one of the defined roles in your DB like Student, Admin, Employee etc. The action method which is called when your website gets launched will call your web API to validate the authenticity of the user who is trying to login. After the login is successfull it should also fetch the role information of the logged in user from the web API. When you have role information with you then simply use a switch clause as shown below to redirect to appropriate view:
public ActionResult Login()
{
//call web api to validate the user credentials
var role = <call the web api to get the role of the user>;
switch (role)
{
case "Admin" :
return View("Admin");
case "Student" :
return View("Student");
case "Employee" :
return View("Employee");
case "Others" :
return View("Others");
}
}
Hope this helps!
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
When a user that usually authenticates with his facebook account and tries to run the "Reset Password" operation, he gets an email and can reset his password (which is clearly doesn't make sense because he does not have a password).
I guess it is just a bug in the "Reset Password" operation, but just to make sure, did it happen to anyone else?
Technically there is a password... and an app can allow a user authenticated via FB to set the username and password properties for their User object, giving them multiple avenues for logging in.
Fair point that we can likely identify this scenario and prompt the user to log in via Facebook.