Teradata : Which dbc table contains the ACCOUNT field? - teradata

I need to find out what is my account . I looked at the following tables :
dbc.accounts
DBC.AccountInfoV
DBC.ProfileInfo
They have the accountname, which is not the same . WHere can I find my account ?
Thanks

Your currently active account can be retrieved using the built-in ACCOUNT function:
SELECT ACCOUNT;
Your default account is returned by:
SELECT DefaultAccount
FROM dbc.UsersV
WHERE UserName = USER;
And the list of all accounts your user might use, assigned either to the user directly or via the user's profile:
SELECT AccountName
FROM dbc.accountinfoVX
WHERE (PROFILE IS NULL AND USERNAME = USER)
OR (USERNAME = PROFILE)

Related

How to get specific data from Realtime Database in flutter?

I have fetched the snapshot values named as name and role and I store
them as userName and user role.
I want to access the same data in the same widget but it cannot recognize. Please help
You have to declare (and initialize userName and userRole variables if you are using newer versions of dart) before the Widget. Something like:
String userName = "", userRole = "";
or
late String userName, userRole;

Need to enter more data for user sign up in Firebase

I'm new to Firebase. I was looking at the Firebase documentation and it seems good. But one thing I've noticed is that when I register/sign up my users, I can only get their email ID and password.
However, for my app, I need my users to enter more details like name, address, phone, and some other details. How can I do this?
I thought maybe I can use the real time database, but then I didn't know how to match the users with their respective details from the realtime database. Please give me some ideas on how to do this.
You're right.
In order to save some user data, you will have to use Realtime Database. There are few properties you can assign to user like email, photoURL, displayName but for more than that you have to use database.
Hope it helps, here is a way I am doing it:
I created "users" node in database and every time new user registers, new entry with his uid gets inserted. Check screenshot below:
So every time you need to get user data, just call child at "users" node with given "current user uid".
On Success of registration , get all the details and update/create the information in firebase database.
final String emailId = mEditTextEmail.getText().toString() ;
String password = mEditTextPassword.getText().toString() ;
firebaseRef.createUser(emailId, password, new Firebase.ValueResultHandler<Map<String,Object>>() {
#Override
public void onSuccess(Map<String, Object> stringObjectMap) {
User user = new User();
user.setUid(stringObjectMap.get("uid").toString());
user.setEmail(emailId);
user.setProfileStatus(User.NEW);
firebaseRef.child("Users").child(user.getUid()).setValue(user);
mProgressBar.setVisibility(View.GONE);
Intent intent = new Intent(SignupActivity.this,LoginActivity.class);
intent.putExtra("email",mEditTextEmail.getText().toString());
startActivity(intent);
Toast.makeText(getBaseContext(),"You are Successfully Registered in",Toast.LENGTH_SHORT).show();
Toast.makeText(getBaseContext(),"Login to continue..",Toast.LENGTH_SHORT).show();
}

SQL Return all rows if admin, otherwise return user records

When using SQL DataSource, I want to return the record essentially tied to the currently logged in user. I can do this, just fine.
But, when that logged in user is tagged as 'ADMIN' in the user table, I want to return all rows.
Fields:
Name
Address
databaseid
IsAdmin
ASP.net page sends #databaseid
SQL server returns Name and Address for #databaseid user only. Perfect!
but I want to return everything in the table if IsAdmin = 1 for that given databaseuserid.
I am using a SP to return records. Basically ignore the filter.
Can you modify the stored proc? If so, then change the select stmt:
SELECT Name, Address, databaseid, IsAdmin
FROM YourTableName
WHERE databaseid = #databaseid
OR 1 = (SELECT IsAdmin
FROM YourTableName
WHERE databaseid = #databaseid);

ASP membership or facebook membership (working with db and process)

I want to ask you for something:
I want do an IS on asp.net (MVC) with my custom membership connected to MSSQL
On DB will be more things and there will be a lot of connection with "userId"
But it's not a necessary to create NEW account just for this IS (but you can)...
But if you choose that you don't want create new account you can join with your FB.
But there is a problem... How create a design and working with my DB when you are just FB user and you want make some change (add some data to DB... And this data are connected to your account but it can be IS-account or FB, and of course I want to add users to roles, and with the FB? It's possible?)
Here is my part of DB which is responsible for memberships:
User:
id ( uniqueidentifier PK)
username (text)
password..
....
Role:
id ( uniqueidentifier PK)
name ( text)
UsersInRoles:
id ( uniqueidentifier)
roleID (uniqueidentifier (FK from Role) )
userID (uniqueidentifier (FK from User) )
And I am using an ID (PK from User table everywhere (in other tables) as signatures who add a new item and other)
Thank you.

WebSecurity.ChangePassword returning FALSE value

I can't figure out why my WebSecurity.ChangePassword is not working. Here's the piece of code I'm working on.
if (WebSecurity.ChangePassword(USER, oldpass, password)) {
Response.Redirect("~/SuperAdmin");
return;
}else {
ModelState.AddFormError(USER);
// I put the each WebSecurity.ChangePassword parameter to this parameter to check whether
//each parameter valid or not (print it out)
}
and for each parameter of WebSecurity.ChangePassword, I retrieve it from the database as follows
if(IsPost){
Validation.RequireField("email", "Masukkan email");
Validation.RequireField("password", "Masukkan Password");
Validation.RequireField("userid", "user ID tidak ada!");
email = Request.Form["email"];
password = Request.Form["password"];
userId = Request.Form["userId"];
if(Validation.IsValid()){
var db = Database.Open("StarterSite");
var updateCommand2 = "UPDATE UserProfile SET Email=#0 WHERE UserId=#1";
db.Execute(updateCommand2, email,userId);
var USER = db.QueryValue("SELECT a.Email FROM UserProfile a, webpages_Membership b WHERE a.UserId=b.UserId AND a.UserId= #0", userId);
var oldpass = db.QueryValue("SELECT Password FROM webpages_Membership WHERE UserId = #0", userId);
Can anyone tell me what seems to be the problem here? Thanks in advance
The WebPages Membership has everything built you do not need to get the users email address and password (I am guessing the email address is the username right?) The ChangePassword method takes 3 arguments. which is UserName, CurrentPassword, NewPassword.
The reason your getting false is because your getting the old password from the database based on the users current Id, but the old password does not match the users current password because old one is encrypted and you're not encrypting the one they submit (in fact you don't even have a field for them to enter their current password).
The WebPages Membership provider will do all the updating you do not need open the database and update the users password, the weird thing you're doing is telling the user to enter a new password but not asking for the current one! Here see this for more information:
http://www.thecodingguys.net/reference/asp/websecurity-changepassword
Make sure the user you are trying to change password for is not LockedOut. You can check it by this
select * from aspnet_membership
where
IsLockedOut = 1

Resources