Admin

Description

In BBj 11.0 and higher, the Admin Utility provides access to BBj user authentication and permissions via the Admin API.

Creation

The Admin class is found in <bbj install>/utils/admin.bbj.

To create an Admin object, use the default constructor:
admin! = new Admin()

Parameters

None.

Methods of Admin

Return Value

Method

string

getHost()

string

getLastErrorMsg()

static string

getLocalAdminPassword()

string

getPassword()

int

getPort()

boolean

getRemember()

int

getRequiredPermissions()

boolean

getSSL()

int

getTimeout()

string

getUser()

UserCredentials

getUserCredentials()

UserCredentials

getUserCredentialsFromCookie()

void

removeAllUsersCredentialsCookies()

void

removeUserCredentialsCookie()

void

saveUserCredentialsToCookie(userCredentials credentials)

void

setHost(string host)

void

setPassword(string password)

void

setPort(int port)

void

setRemember(boolean remember)

void

setRequiredPermissions(int permissions)

void

setSSL(boolean ssl)

void

setTimeout(int timeout)

void

setUser(string user)

boolean

validate(UserCredentials credentials)

Remarks

None.

Constants

Name

Value

NO_PERMISSIONS

0

ATTACH_EXISTING_DB

1

CREATE_NEW_DB

2

DELETE_DB

4

ADD_USER

8

DELETE_USER

16

SET_PERMISSIONS

32

SET_PASSWORDS

64

PROCESSES

128

OPEN_FILES

256

JDBC_CONNECTIONS

512

SERVER_CONFIG

1024

ALLOW_ADMIN

2048

CREATE_NEW_TRIGGER

4096

CONNECTION_POOLS

8196

COPY_JOBS

16384

TABLE_ANALYSIS_QUEUE

32768

ALL_PERMISSIONS

65536

Example

rem Admin Utility Demo

 rem Use Statements
 use ::admin.bbj::Admin
 use ::admin.bbj::UserCredentials

 rem Declares
 declare Admin admin!
 declare UserCredentials userCredentials!

 rem Authenticate the user jsmith
 admin! = new Admin()
 admin!.setUser("jsmith")
 userCredentials! = admin!.getUserCredentials()
 if (userCredentials! <> null())
    print "User: " + userCredentials!.getUser()
    print "Password: " + userCredentials!.getPassword()
    print "Host: " + userCredentials!.getHost()
    print "Port: " + str(userCredentials!.getPort())
    print "SSL: " + str(userCredentials!.getSSL())
    print "Timeout: " + str(userCredentials!.getTimeout())
    end
 else
    print "Could not authenticate user"
 endif
 end 

See Also

BBj Object Syntax

Admin API

UserCredentials