def menu_modules(cls): """ Custom Modules Menu """ from config import drk_default_shelter shelter_id = drk_default_shelter() has_role = current.auth.s3_has_role not_admin = not has_role("ADMIN") if not_admin and has_role("SECURITY"): return [ MM("Residents", c="security", f="person"), #MM("ToDo", c="project", f="task"), MM("Check-In / Check-Out", c="cr", f="shelter", args = [shelter_id, "check-in"], check = shelter_id is not None, ), ] elif not_admin and has_role("QUARTIER"): return [ MM("Residents", c=("dvr", "cr"), f=("person", "shelter_registration")), ] else: return [ MM("Residents", c=("dvr", "pr")), MM("Event Registration", c="dvr", f="case_event", m = "register", p = "create", # Show only if not authorized to see "Residents" # (=the last preceding item) check = lambda this: not this.preceding()[-1].check_permission(), ), MM("ToDo", c="project", f="task"), #homepage("req"), homepage("inv"), MM("Dashboard", c="cr", f="shelter", args = [shelter_id, "profile"], check = shelter_id is not None, ), # @ToDO: Move to Dashboard Widget? MM("Housing Units", c="cr", f="shelter", args = [shelter_id, "shelter_unit"], check = shelter_id is not None, ), homepage("vol"), homepage("hrm"), MM("Facilities", c="org", f="facility"), ]
def menu_modules(cls): """ Custom Modules Menu """ from config import drk_default_shelter shelter_id = drk_default_shelter() has_role = current.auth.s3_has_role not_admin = not has_role("ADMIN") if not_admin and has_role("SECURITY"): return [ MM("Residents", c="security", f="person"), #MM("ToDo", c="project", f="task"), MM("Check-In / Check-Out", c="cr", f="shelter", args = [shelter_id, "check-in"], check = shelter_id is not None, ), ] elif not_admin and has_role("QUARTIER"): return [ MM("Residents", c=("dvr", "cr"), f=("person", "shelter_registration")), ] else: return [ MM("Residents", c=("dvr", "pr")), MM("Event Registration", c="dvr", f="case_event", m = "register", p = "create", # Show only if not authorized to see "Residents" # (=the last preceding item) check = lambda this: not this.preceding()[-1].check_permission(), ), MM("ToDo", c="project", f="task"), #homepage("req"), homepage("inv"), MM("Dashboard", c="cr", f="shelter", args = [shelter_id, "profile"], check = shelter_id is not None, ), # @ToDO: Move to Dashboard Widget? MM("Housing Units", c="cr", f="shelter", args = [shelter_id, "shelter_unit"], check = shelter_id is not None, ), homepage("vol"), homepage("hrm"), MM("Facilities", c="org", f="facility"), ]
def menu_modules(cls): """ Custom Modules Menu """ from config import drk_default_shelter shelter_id = drk_default_shelter() has_role = current.auth.s3_has_role not_admin = not has_role("ADMIN") if not_admin and has_role("SECURITY"): return [ MM("Residents", c="security", f="person"), #MM("ToDo", c="project", f="task"), MM( "Check-In / Check-Out", c="cr", f="shelter", args=[shelter_id, "check-in"], check=shelter_id is not None, ), ] elif not_admin and has_role("QUARTIER"): return [ MM("Residents", c=("dvr", "cr"), f=("person", "shelter_registration")), ] else: return [ MM("Residents", c=("dvr", "pr")), MM("ToDo", c="project", f="task"), #homepage("req"), homepage("inv"), MM( "Dashboard", c="cr", f="shelter", args=[shelter_id, "profile"], check=shelter_id is not None, ), # @ToDO: Move to Dashboard Widget? MM( "Housing Units", c="cr", f="shelter", args=[shelter_id, "shelter_unit"], check=shelter_id is not None, ), homepage("vol"), homepage("hrm"), ]
def cr(): """ CR / Shelter Registry """ from config import drk_default_shelter shelter_id = drk_default_shelter() if not shelter_id: return None ADMIN = current.auth.get_system_roles().ADMIN return M(c="cr")( M("Shelter", f="shelter", args=[shelter_id])( M( "Dashboard", args=[shelter_id, "profile"], ), M( "Housing Units", t="cr_shelter_unit", args=[shelter_id, "shelter_unit"], ), ), #M("Room Inspection", f = "shelter", link=False)( # M("Register", # args = [shelter_id, "inspection"], # t = "cr_shelter_inspection", # p = "create", # ), # M("Overview", f = "shelter_inspection"), # M("Defects", f = "shelter_inspection_flag"), # ), #M("Administration", # link = False, # restrict = (ADMIN, "ADMIN_HEAD"), # selectable=False, # )( # M("Shelter Flags", f="shelter_flag"), # ), )
def menu_modules(cls): """ Custom Modules Menu """ from config import drk_default_shelter shelter_id = drk_default_shelter() has_role = current.auth.s3_has_role not_admin = not has_role("ADMIN") if not_admin and has_role("SECURITY"): return [ MM("Residents", c="security", f="person"), #MM("ToDo", c="project", f="task"), MM("Check-In / Check-Out", c="cr", f="shelter", args = [shelter_id, "check-in"], check = shelter_id is not None, ), ] elif not_admin and has_role("QUARTIER"): return [ MM("Residents", c=("dvr", "cr"), f=("person", "shelter_registration")), ] else: return [ MM("Residents", c=("dvr", "pr")), MM("ToDo", c="project", f="task"), #homepage("req"), homepage("inv"), MM("Dashboard", c="cr", f="shelter", args = [shelter_id, "profile"], check = shelter_id is not None, ), # @ToDO: Move to Dashboard Widget? MM("Housing Units", c="cr", f="shelter", args = [shelter_id, "shelter_unit"], check = shelter_id is not None, ), homepage("vol"), homepage("hrm"), ]
def cr(): """ CR / Shelter Registry """ from config import drk_default_shelter shelter_id = drk_default_shelter() if not shelter_id: return None #ADMIN = current.session.s3.system_roles.ADMIN return M(c="cr")( M("Shelter", f="shelter", args=[shelter_id])( M("Dashboard", args = [shelter_id, "profile"], ), M("Housing Units", t = "cr_shelter_unit", args = [shelter_id, "shelter_unit"], ), ), )
def cr(): """ CR / Shelter Registry """ from config import drk_default_shelter shelter_id = drk_default_shelter() if not shelter_id: return None ADMIN = current.auth.get_system_roles().ADMIN return M(c="cr")( M("Shelter", f="shelter", args=[shelter_id])( M("Dashboard", args = [shelter_id, "profile"], ), M("Housing Units", t = "cr_shelter_unit", args = [shelter_id, "shelter_unit"], ), ), #M("Room Inspection", f = "shelter", link=False)( # M("Register", # args = [shelter_id, "inspection"], # t = "cr_shelter_inspection", # p = "create", # ), # M("Overview", f = "shelter_inspection"), # M("Defects", f = "shelter_inspection_flag"), # ), #M("Administration", # link = False, # restrict = (ADMIN, "ADMIN_HEAD"), # selectable=False, # )( # M("Shelter Flags", f="shelter_flag"), # ), )
def menu_modules(cls): """ Custom Modules Menu """ from config import drk_default_shelter shelter_id = drk_default_shelter() has_role = current.auth.s3_has_role not_admin = not has_role("ADMIN") if not_admin and has_role("SECURITY"): return [ MM("Residents", c="security", f="person"), MM( "Dashboard", c="cr", f="shelter", args=[shelter_id, "profile"], check=shelter_id is not None, ), #MM("ToDo", c="project", f="task"), MM( "Check-In / Check-Out", c="cr", f="shelter", args=[shelter_id, "check-in"], check=shelter_id is not None, ), MM("Confiscation", c="security", f="seized_item"), ] elif not_admin and has_role("QUARTIER"): return [ MM("Residents", c=("dvr", "cr"), f=("person", "shelter_registration")), MM("Confiscation", c="security", f="seized_item"), ] else: return [ MM("Residents", c=("dvr", "pr")), MM( "Event Registration", c="dvr", f="case_event", m="register", p="create", # Show only if not authorized to see "Residents" check=lambda this: not this.preceding()[-1]. check_permission(), ), MM( "Food Distribution", c="dvr", f="case_event", m="register_food", p="create", # Show only if not authorized to see "Residents" check=lambda this: not this.preceding()[-2]. check_permission(), ), MM( "Food Distribution Statistics", c="dvr", f="case_event", m="report", vars={"code": "FOOD*"}, restrict=("FOOD_STATS", ), # Show only if not authorized to see "Residents" check=lambda this: not this.preceding()[-3]. check_permission(), ), MM("ToDo", c="project", f="task"), MM( "Dashboard", c="cr", f="shelter", args=[shelter_id, "profile"], check=shelter_id is not None, ), # @ToDO: Move to Dashboard Widget? MM( "Housing Units", c="cr", f="shelter", t="cr_shelter_unit", args=[shelter_id, "shelter_unit"], check=shelter_id is not None, ), homepage("vol"), homepage("hrm"), MM("More", link=False)( MM("Facilities", c="org", f="facility"), #homepage("req"), homepage("inv"), SEP(link=False), MM("Confiscation", c="security", f="seized_item"), SEP(link=False), MM( "Surplus Meals", c="default", f="index", args="surplus_meals", t="dvr_case_event", restrict=("ADMINISTRATION", "ADMIN_HEAD", "INFO_POINT", "RP"), ), ), ]
def menu_modules(cls): """ Custom Modules Menu """ from config import drk_default_shelter shelter_id = drk_default_shelter() has_role = current.auth.s3_has_role not_admin = not has_role("ADMIN") if not_admin and has_role("SECURITY"): return [ MM("Residents", c="security", f="person"), MM("Dashboard", c="cr", f="shelter", args = [shelter_id, "profile"], check = shelter_id is not None, ), #MM("ToDo", c="project", f="task"), MM("Check-In / Check-Out", c="cr", f="shelter", args = [shelter_id, "check-in"], check = shelter_id is not None, ), MM("Confiscation", c="security", f="seized_item"), ] elif not_admin and has_role("QUARTIER"): return [ MM("Residents", c=("dvr", "cr"), f=("person", "shelter_registration")), MM("Confiscation", c="security", f="seized_item"), ] else: return [ MM("Residents", c=("dvr", "pr")), MM("Event Registration", c="dvr", f="case_event", m = "register", p = "create", # Show only if not authorized to see "Residents" check = lambda this: not this.preceding()[-1].check_permission(), ), MM("Food Distribution", c="dvr", f="case_event", m = "register_food", p = "create", # Show only if not authorized to see "Residents" check = lambda this: not this.preceding()[-2].check_permission(), ), MM("Food Distribution Statistics", c="dvr", f="case_event", m = "report", vars = {"code": "FOOD*"}, restrict = ("FOOD_STATS",), # Show only if not authorized to see "Residents" check = lambda this: not this.preceding()[-3].check_permission(), ), MM("ToDo", c="project", f="task"), MM("Dashboard", c="cr", f="shelter", args = [shelter_id, "profile"], check = shelter_id is not None, ), # @ToDO: Move to Dashboard Widget? MM("Housing Units", c="cr", f="shelter", t = "cr_shelter_unit", args = [shelter_id, "shelter_unit"], check = shelter_id is not None, ), homepage("vol"), homepage("hrm"), MM("More", link=False)( MM("Facilities", c="org", f="facility"), #homepage("req"), homepage("inv"), SEP(link=False), MM("Confiscation", c="security", f="seized_item"), SEP(link=False), MM("Surplus Meals", c="default", f="index", args = "surplus_meals", t = "dvr_case_event", restrict = ("ADMINISTRATION", "ADMIN_HEAD", "INFO_POINT", "RP"), ), ), ]