Giter Site home page Giter Site logo

Comments (3)

derntl avatar derntl commented on June 8, 2024

This is application logic and should be implemented in a plugin function. You can do that using the setting $LOGIN['initializer_proc'] or $APP['preprocess_func'] (these are called at the very beginning of processing), sometimes we also do it in $APP['menu_complete_proc'], because often the menu items need to be adapted based on user roles as well.

You can check whether someone is logged in via function is_logged_in(). The ID of the logged in user is in $_SESSION['user_id'] and the other user details are in $_SESSION['user_data']

from dbwebgen.

BlackRule avatar BlackRule commented on June 8, 2024

Why

$TABLES = array (
	'accommodations' => array (
		'display_name' => $__arr['Accommodations'],
		'description' => '',
		'item_name' => $__arr['Accommodation'],
		'actions' => $ALL_ACTIONS <- ISN'T ROLE/USER BASED
		'fields' => array (

there's no rights config in $TABLES ? I'll try to hide menus concerning creation of elements but I'm afraid consequently, following "add item" near field which is a reference to another table user still will be able to create items and so on...
I'd like to write such code

$RIGHTS = array(
	0 => array( //--can edit EVERYTHING
		'accommodations' => $ALL_ACTIONS,
		'clients' => $ALL_ACTIONS,
	),
	1 => array( //--can't edit users
		'accommodations' =>array(),
		'clients' => $ALL_ACTIONS,
	),
	2 => array( //--can edit only reference books
		'accommodations' => array(),
		'clients' => $ALL_ACTIONS
	)
);
foreach ($TABLES as $key => $value) {
	$value["actions"] = $RIGHTS[$_SESSION["user_id"]][$key];
}

from dbwebgen.

derntl avatar derntl commented on June 8, 2024

The answer is in my previous comment. Roles and associated rights are application specific and therefore not part of the global settings. You need to use one of the functions mentioned in my above comment to modify menus and allowed table actions based on the logged-in user with your $RIGHTS array.

from dbwebgen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.